<?php
namespace app\index\Validate;
use think\Validate;

class Goods extends Validate{

    //验证规则
    protected $rule = [
        'gd_title'     =>'require|max:70',
        'gd_classify'  =>'require',
        'gd_num'       =>'require|number|max:4',
        'gd_money'     => 'require|max:9',
        'gd_uid'       => 'require|number',
        'gd_way'       => 'require',
    ];

    protected $message  =  [
        'gd_title.require'    => '标题必须填写',
        'gd_title.max'        => '标题长度超过限制',
        'gd_classify.require' => '分类必须选择',
        'gd_num.require'      => '数量必须填写',
        'gd_num.max'          => '数量超过限制',
        'gd_num.number'       => '数量必须是数字',
        'gd_money.require'    => '价格必须填写',
        'gd_money.max'        => '价格超过限制',
        'gd_uid.require'      => '用户信息错误',
        'gd_uid.number'       => '用户信息错误',
        'gd_way.require'      => '交易方式必填',
    ];

    protected $scene = [
        'edit'  =>  ['gd_title','gd_money']
    ];


}